package com.bems.service;

import java.util.List;

import com.bems.dao.WareDao;
import com.bems.pojo.Ware;
import com.bems.util.PageUtil;

public class WareService {

	
	public PageUtil list(String type,int page,int size)
	{
		PageUtil pageUtil = new PageUtil();
		pageUtil.setSize(size);
		pageUtil.setPage(page);
		String filter = "type_id = "+ type;
		int totalpage = new Ware().totalCount(filter );
		pageUtil.setTotalpage(totalpage );
		List<Ware> list = (List<Ware>) new Ware().filter(filter, page, size);
		pageUtil.setList(list );
		return pageUtil;
	}
	
	public double getTotal(String type_id) 
	{
		
		return wareDao.getTotal(Integer.parseInt(type_id));
		
	}
	
	WareDao wareDao = new WareDao();
	
}
